package goldeneagle.com.user.servlet;

import goldeneagle.com.entity.User;
import goldeneagle.com.user.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/*
 *Created by GHW
 *Description:
 *2019/11/14 21:38
 */
@WebServlet(value = "/FindUserServlet")
public class FindUserServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        UserService userService = new UserService();
        User user = new User();

        String username = request.getParameter("username");
        System.out.println(username);
        user = userService.FindUserByUsername(username);
        request.setAttribute("userInfo",user);
        request.getRequestDispatcher("personalfix.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request,response);
    }
}
